import request from '@/config/axios'

// 产品报价 VO
export interface ProdCoaVO {
  id: number // id
  prodId: number // 产品ID
  coaNum: string // 检测COA单号
  coaDate: Date // 检测日期
  formattedCoaDate: string // 格式化后的检测日期
  fileId: number // 图片ID
  remark: string // 备注
  type: string // 类型
  creator: string // 上传人
  url: string // file 表中文件 url
}

// 产品报价 API
export const ProdCoaApi = {
  // 查询产品报价分页
  getProdCoaPage: async (params: any) => {
    return await request.get({ url: `/business/prod-coa/page`, params })
  },

  // 查询产品报价详情
  getProdCoa: async (id: number) => {
    return await request.get({ url: `/business/prod-coa/get?id=` + id })
  },

  // 新增产品报价
  createProdCoa: async (data: ProdCoaVO) => {
    return await request.post({ url: `/business/prod-coa/create`, data })
  },

  // 修改产品报价
  updateProdCoa: async (data: ProdCoaVO) => {
    return await request.put({ url: `/business/prod-coa/update`, data })
  },

  // 删除产品报价
  deleteProdCoa: async (id: number) => {
    return await request.delete({ url: `/business/prod-coa/delete?id=` + id })
  },

  // 导出产品报价 Excel
  exportProdCoa: async (params) => {
    return await request.download({ url: `/business/prod-coa/export-excel`, params })
  },

  // 查询产品报价详情
  getProdCoaForUrl: async (id: number) => {
    return await request.get({ url: `/business/prod-coa/get-url?id=` + id })
  },
}
